home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
LDB171.ARJ
/
EXAMP501.CPP
< prev
next >
Wrap
Text File
|
1992-05-12
|
930b
|
47 lines
// examp501.cpp - link with binder.obj
// rework of examp303.cpp
#define ffile "examp501.txt"
#include <iostream.h>
#include <iomanip.h>
#define FType float
#define FBinder fbdr
#define FBindeR fbdR
#include "fbinder.hpp"
int fcmp(const float *f1, const float * f2)
{ return (*f2 - *f1); } // descending order
main() // count to five
{
fbdR fB = new fbdr (BDR_DNEW | BDR_DDELETE
| BDR_DSTORE,5);
if (!fB) return 1;
float f = 1.0;
while (fB->insNew(&f)) f++;
fB->setComP ((BDRcomP) fcmp);
Binder::RegisterComP ((BDRcomP) fcmp);
fB->save(ffile);
delete fB;
fbdr fb(ffile);
fb.sort();
fb.setFlags(BDR_DASSIGN);
while (fb.prevAsg(&f))
cout << f << endl;
return 0;
}